import 'package:flutter/material.dart';
import 'package:flutter_layout/pages/custom/custom_shape.dart';
import 'package:fluttertoast/fluttertoast.dart';

class ReceivedMessageScreen extends StatelessWidget {
  final String? message;

  const ReceivedMessageScreen({
    Key? key,
    @required this.message,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final messageTextGroup = Flexible(
        child: Row(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Transform(
          alignment: Alignment.center,
          transform: Matrix4.rotationY(0),
          // transform: Matrix4.rotationY(3.1415926),
          // transform: Matrix4.rotationY(math.pi),
          child: CustomPaint(
            painter: CustomShape(Colors.grey[300]),
          ),
        ),
        // Listener(
        //   child:
        Flexible(
          child: InkWell(
            highlightColor: Colors.transparent,
            splashColor: Colors.transparent,
            onTap: () {
              Fluttertoast.showToast(msg: message!);
            },
            child: Container(
              padding: const EdgeInsets.all(14),
              decoration: BoxDecoration(
                color: Colors.grey[300],
                borderRadius: const BorderRadius.only(
                  topRight: Radius.circular(18),
                  bottomLeft: Radius.circular(18),
                  bottomRight: Radius.circular(18),
                ),
              ),
              child: Text(
                message!,
                style: const TextStyle(color: Colors.black, fontSize: 14),
              ),
            ),
          ),
        ),
        //   onPointerUp: (event) {
        //     Fluttertoast.showToast(msg: message!, gravity: ToastGravity.CENTER);
        //   },
        // ),
      ],
    ));

    return Padding(
      padding: const EdgeInsets.only(right: 18.0, left: 50, top: 15, bottom: 5),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.end,
        children: <Widget>[
          const SizedBox(height: 30),
          messageTextGroup,
        ],
      ),
    );
  }
}
